Những câu hỏi liên quan
Felix MC-Gamer
Xem chi tiết
luu tean khanh
Xem chi tiết
Phía sau một cô gái
27 tháng 2 2023 lúc 19:46

var A:

     array[1..n] of int64;

     i, n, count: integer;

begin

     write('Nhap so phan tu cua mang: ');

     readln(n);

     for i := 1 to n do

     begin

          write('Nhap phan tu thu ', i, ': ');

          readln(A[i]);

      end;

 

     count := 0;

     for i := 1 to n do

          if A[i] > 0 then

               count := count + 1;

     writeln('So luong cac so nguyen duong trong mang la: ', count); end.

Bình luận (0)
89654DAUUBUOIIIII956
Xem chi tiết
Phía sau một cô gái
22 tháng 7 2023 lúc 20:06

program tong_so_le;

var

     n, i, a_i, tong: integer;

begin

     writeln('Nhap vao so nguyen khong am n:');

     readln(n);

     while (n <= 0) or (n > 100) do

     begin

          writeln('So nguyen n phai thoa man 0 < n <= 100, vui long nhap lai:');

          readln(n);

     end;

     writeln('Nhap vao ', n, ' so nguyen a1, a2, ..., an:','<mỗi số nguyên nhập trên một hàng>');

     tong := 0; // Khởi tạo tổng bằng 0

     for i := 1 to n do

     begin

          readln(a_i);

          if i mod 2 = 1 then

               tong := tong + a_i; 

     end;

     writeln('Tong cac so tai vi tri le trong mang la: ', tong);

end.

Bình luận (0)
Trần Minh Vương
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 11 2021 lúc 23:26

uses crt;

const fi='doc.inp'

var f1:text;

n,i:integer;

a:array[1..255]of integer;

begin

clrscr;

assign(f1,fi); reset(f1);

readln(f1,n);

for i:=1 to n do 

 read(f1,a[i]);

min:=a[1];

for i:=1 to n do 

  if min>=a[i] then min:=a[i];

writeln(min);

close(f1);

readln;

end.

Bình luận (0)
Bình Lưu
Xem chi tiết
Nguyễn Quốc Đạt
6 tháng 10 2023 lúc 19:27

#include <bits/stdc++.h>

using namespace std;

int main() {

long long n;

cin >> n;

int can = (long long)(sqrt(n));

cout << n + can;

return 0; 

 } 

Bình luận (0)
Hiếu Nguyễn
Xem chi tiết
Nghị Trương Thành
9 tháng 7 2022 lúc 21:40

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll i, j, n, a[1000005], dem = 0, m;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> a[i];
        if (a[i] % 3 == 0)
        {
            n--;
            i--;
        }
    }
    for (i = 1; i <= n; i++)
    {
        cout << a[i] << " ";
    }
    cout<<endl;
    for(i=1;i<=n;i++)
    {
        if(a[i]%5==0)
        {
            for(j=i;j<=n;j++)
            {
                a[j]=a[j+1];
            }
            n--;
            i--;
        }    
    }
    for(i=1;i<=n;i++)
    {
        cout<<a[i]<<" ";
    }
    return 0;
}

Bình luận (0)
Yến Chi Phan Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
8 tháng 3 2022 lúc 6:55

uses crt;

const fi='dulieu.dat'

var f1:text;

a,b,p,s:array[1..100]of real;

i,n:integer;

begin

clrscr;

assign(f1,fi); reset(f1);

n:=0;

while not eof(f1) do 

begin

n:=n+1;

readln(a[n],b[n]);

end;

for i:=1 to n do 

  begin

p[i]:=(a[i]+b[i])/2;

s[i]:=a[i]*b[i];

end;

for i:=1 to n do 

  writeln(p[i]:4:2,' ',s[i]:4:2);

close(f1);

readln;

end.

Bình luận (0)
Nguyễn Thị Tươi
Xem chi tiết
Hello1234
Xem chi tiết
Minh Hiếu
8 tháng 9 2021 lúc 6:40

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (1)
Minh Hiếu
8 tháng 9 2021 lúc 6:41

#include <iostream>
using namespace std;
int main()
{
    int t,m,n,ucln;
    cout<<"Nhap n="; cin>>n;
    cout<<"Nhap m="; cin>>m;
    t=m%n;
    while (t!=0)
    {
        t=n%m;
        n=m;
        m=t;
    }
    ucln=n;
    cout<<ucln;
    return 0;
}

Bình luận (1)
Nguyễn Lê Phước Thịnh
8 tháng 9 2021 lúc 23:19

#include <iostream>
using namespace std;
int main()
{
    int n,i,j;
    cout<<"Nhap n="; cin>>n;
    for (i=1; i<=n; i++)
    {
        for (j=i; j<=i+n-1; j++)
            cout<<j<<" ";
        cout<<endl;
    }
    return 0;
}

Bình luận (0)
Lê Tâm Anh
Xem chi tiết
gấu béo
7 tháng 5 2023 lúc 19:20

program Le_Nho_Hon_Hoac_Bang_n;

uses crt;

var

       n, i: integer;

begin

       clrscr;

       write('Nhap vao mot so nguyen duong n: ');

       readln(n);

       while n <= 0 do

       begin

              writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');

              readln(n);

       end;

       clrscr;

       writeln('Cac so le nho hon hoac bang ', n, ' la:');

       i := 1;

       while i <= n do

       begin

              if i mod 2 <> 0 then

                     writeln(i);

              i := i + 1;

       end;

       readln;

end.

Bình luận (0)